package com.ezonsport.android.ui;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;

import com.ezonsport.android.R;
import com.ezonsport.android.SystemConstant;
import com.ezonsport.android.adapter.StepAdapter;

public class DataHistoryActivity extends Activity {
	private ListView mListView;
	private StepAdapter mListAdapter;
	private List<Map<String,Object>> mListItems;
	private String[] date = {"2012-04-15","2012-04-16","2012-04-17","2012-04-18","2012-04-19"};
	private String[] miles = {"2.5","3.23","5.4","10","4.3"};
	private String[] steps = {"1200","3200","5000","10000","4500"};
	private String[] calories = {"200","320","450","800","400"};
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.datahistory);
        mListView = (ListView)findViewById(R.id.datahistory_datalist);
        mListItems = getListItems();
        mListAdapter = new StepAdapter(this, mListItems);
        mListView.setAdapter(mListAdapter);
	}
	
	public List<Map<String, Object>> getListItems(){
		List<Map<String, Object>> listItems = new ArrayList<Map<String,Object>>();
		
		for(int i=0; i<miles.length; i++){
			Map<String, Object> map = new HashMap<String, Object>();
			map.put(SystemConstant.DataHistory.LISTITEM_DATE, date[i]);
			map.put(SystemConstant.DataHistory.LISTITEM_MILES, miles[i]);
			map.put(SystemConstant.DataHistory.LISTITEM_STEPS, steps[i]);
			map.put(SystemConstant.DataHistory.LISTITEM_CALORIES, calories[i]);
			listItems.add(map);
		}
		return listItems;
	}
}
